<template>
  <div>
      <!-- 头部开始 -->
        <myheader />
      <!-- 头部结束 -->

      <!-- 表单区域 -->
        <div class="udlite-container partners">
            <van-cell-group>
                <van-field v-model="username" label="用户名" placeholder="请输入用户名" />
                <van-field v-model="password" label="密码" placeholder="请输入密码" />

                <van-button type="primary" @click="login">登录</van-button>
                <van-button type="info">重置</van-button>
            </van-cell-group>
        </div>
      <!-- 表单区域 -->
  </div>
</template>

<script>
import myheader from './myheader'
export default {
    data() {
        return {
            username:'',
            password:''
        }
    },

    // 声明组件
    components:{
        myheader,
    },

    methods:{
        login:function(){
        if (this.username == ""){
                this.$toast("请填写登录信息");
                return false;
            }
        this.axios.get('http://localhost:8000/login/', {params:{username:this.username,
        password:this.password}}).then(res=>{
            console.log(res.data)
            if (res.data.code == '200'){
                alert('登录成功！')
            }
            else{
                alert(res.data.message)
            }
        })
    }
    }
}
</script>

<style>

</style>